package com.zmn.oms.dubbo.impl.normal.order;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.vo.KVDict;
import com.zmn.oms.dubbo.interfaces.normal.order.OrderConfigRemoteService;
import com.zmn.oms.dubbo.utils.DubboConsts;
import com.zmn.oms.zmn.business.interfaces.config.OrderConfigBService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * 类描述：
 *
 * @author wangxiaokun
 * @since 2021/10/25 18:09
 */
@Slf4j
@Service(loadbalance = "roundrobin", timeout = 10000, retries = 0, version = DubboConsts.INTERFACE_VERSION, validation = "true")
public class OrderConfigRemoteServiceImpl implements OrderConfigRemoteService {

    @Autowired
    private OrderConfigBService orderConfigBService;

    @Override
    public ResponseDTO<List<KVDict>> getAcceptanceConfig(Long orderId) {
        log.info("查询验收配置入参：{}", orderId);
        try {
            List<KVDict> list = orderConfigBService.getAcceptanceConfig(orderId);
            return ResponseDTO.success(list);
        } catch (Exception e) {
            log.error("[{}]查询验收配置异常：[{}]", orderId, e.getMessage());
            e.printStackTrace();
            return ResponseDTO.fail();
        }
    }
}
